﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using AceSoft.RetailPlus.DataService;
using AceSoft.RetailPlus.Security;
using System.Web.Security;

namespace AceSoft.RetailPlus.Controllers
{
    public class AuthController : Controller
    {
        public ActionResult Login()
        {
            return View();
        }



        [HttpPost]
        public JsonResult Login(LoginModel myLogin, string returnUrl)
        {

            //bool isValidated =
            //  RetailPlus.DataService.Login.ValidateUser(myLogin);

            //if (isValidated)
            //{
            ///*Flag that login is successful*/
            FormsAuthentication.SetAuthCookie(myLogin.Username, true);
            //}


            // return new JsonResult() { Data = myLogin.Username + "User was saved!" };
            return Json(new { url = "/Loans/Dashboard", errCode = "ok" });
        }

        public ActionResult Logout()
        {

            FormsAuthentication.SignOut();
            return RedirectToAction("Login");

        }

        public ActionResult Register()
        {
            return View();
        }

        public ActionResult ForgotPassword()
        {
            return View();
        }
    }
}
